Central Event System (Plug-ins)

Available Events

There are 2 events fired by the Central Event System; Action and NeedObject. The Action event fires when an action is performed by the code (eg. result sorting, document reading etc). The NeedObject event fires when certain objects are created, this event allows the object type to be overridden with a subclass.

Action Event

The event arguments for an Action event are of type ActionEventArgs which has a property Name. The Name specifies what action has occurred, see below for a list of names, their description and what object can be found in the ActionEventArgs.Data property.

(Please also see the Keyoti.SearchEngine.Events.ActionName type under the API documentation ('Namespaces') for a complete up to date list.)

ActionEventArgs.NameDescription
AutoAssignContent The content category for a document was auto assigned, Data contains the DocumentRecord object.
AutoAssignLocation The location category for a document was auto assigned, Data contains the DocumentRecord object.
AutoAssignSecurityGroup, The security group a document was auto assigned, Data contains the DocumentRecord object.
AutoCompleteSuggestionsGenerated The autocomplete suggestions have been generated, Data contains an ArrayList of SuggestionResultPair objects, the sender of this event is SearchBoxAutoCompleteHelper and it has properties 'Query' and 'Segments' which may be of use - NOTE that this event is only fired when SearchBox.AutoCompleteQueryLoadPlugin is true.
CalculateWordRelevancies The words have been read from a document that is being indexed and each word has been assigned a weight, Data contains the WordCollection from Document.CalculateWordRelevancies method argument.
DocumentBeingCrawled The crawl-able links in a document are being processed, Data contains a 2 element object array - the 1st element is the Document object being crawled, and the 2nd element is an ArrayList of Uri objects found as links in the Document.
DocumentImporterAddingDocument A document is about to be imported from an indexable source, Data contains AddDocumentEventArgs object, which has a Cancel property to enable canceling of this action.
DocumentIndexed A document has been indexed, Data is the Document object.
DiscoveredLinkedURLs New URLs have been found by reading document links, Data contains an ArrayList of string objects (the link URLs), which can be modified.
GetIndexableSourceRecords The data-access layer is returning a list of IndexableSourceRecords. Note that changing the list may make the search engine unstable - as any CRUD operations on the indexable source record table may not reflect changes made during this event, handle NeedObject for XmlIndexableSourceRecordTable instead.
GetWordVariations Variations (typically lemmas via stemming) of a word are required. Data contains a 2 element object array; first element is a Word object for the word that variations are needed for, and the second element is an ArrayList of strings holding the variations. The second element can be modified as desired.
ImportStarted An import operation has started, Data contains the IndexableSourceRecord instance that is being imported.
ImportFinished An import operation has ended, Data contains either an ArrayList of Uri objects that were imported, or if an exception occurred, it contains an Exception object.
IsDocumentToBeCrawled The document has been checked to see if it will be crawled, Data contains IsDocumentToBeCrawledEventData and the WillCrawl property may be changed.
IsDocumentToBeIndexed The document has been checked to see if it will be crawled, Data contains IsDocumentToBeIndexedEventData and WillIndex property may be changed.
IsFileSystemDocumentToBeIndexed A document, found during a file system import is about to be indexed, Data contains IsFileSystemDocumentToBeIndexedEventData and WillIndex property may be changed.
IsResultCustomDataFilteredThrough Whether a ResultItem should be included in the search results, Data contains CustomDataFilterActionData and its IsFilteredThrough property may be changed.
QueryExpressionGroupCreated The raw query text has been parsed in to a GroupElement object, Data contains the GroupElement object which may be changed.
ReadLinks The links in a document have been read, Data contains ArrayList of URL strings.
ReadingText The text in a document has been parsed and is about to be weighted, use this event to modify the document text before it's weighted, Data contains DocumentText object.
ReadText The text in a document has been read, Data contains DocumentText object.
RequestingUri A HttpWebRequest object has been created and is about to be sent for a response from the server, Data contains the HttpWebRequest which can be modified.
ResponseFromServerReceived A HttpWebResponse object has been created from a response from the server, Data contains the HttpWebResponse.
ResultItemsFinalized The search result items have been found and sorted, Data contains a Keyoti.SearchEngine.Utils.ResultItemList of ResultItem objects - the order and content of which may be changed.
ResultPreviewTextLoaded The result preview text has been loaded, Data contains a StringBuilder containing the document text, the StringBuilder is modifiable when handling this event, use (sender as SearchResultPreviewHelper).Uri to get the document Uri.
UseDocumentEncoding The Encoding of a document is about to be used, Data contains the Document - the Encoding property may be read and/or set to the required value.

NeedObject Event

The event arguments for a NeedObject event are of type NeedObjectEventArgs, which has properties;
RequiredObject: holding an object of the type needed - the instance set in RequiredObject will be used by the engine, and so this can be modified or reset with a new instance (of a sub-class for example).
Configuration: holding the current Configuration instance

Handling the NeedObject event allows sub-classes of standard types to be injected into the code. Below is a list of classes for which a NeedObject is raised.

ClassTypical Timing
DocumentWhen a new Document instance is created, eg. during import and indexing.
ReaderWhen a document is about to be read, eg. during import and indexing.
ParserProviderWhen a document is about to be parsed into words. Provides the provider for the file type.
XmlContentTableWhen the data access layer creates the object which manages CRUD for content category records.
XmlLocationTableWhen the data access layer creates the object which manages CRUD for location category records.
XmlSecurityGroupTableWhen the data access layer creates the object which manages CRUD for security group records.
XmlIndexableSourceRecordTableWhen the data access layer creates the object which manages CRUD for indexable source records.

The list of available events will expand with subsequent versions - if you need a specific event, please email support@keyoti.com for inclusion.